package day07;

import javax.servlet.jsp.JspWriter;
import javax.servlet.jsp.PageContext;
import javax.servlet.jsp.tagext.SimpleTagSupport;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class DateTag extends SimpleTagSupport {
    private Date date;
    private String format="yyyy/MM/dd HH:mm:ss";


    @Override
    public void doTag() throws IOException {
        PageContext pageContext= (PageContext) getJspContext();
        JspWriter out=pageContext.getOut();


        out.print(new SimpleDateFormat(format).format(date));
    }

    public Date getDate() {
        return date;
    }

    public void setDate(Date date) {
        this.date = date;
    }

    public String getFormat() {
        return format;
    }

    public void setFormat(String format) {
        this.format = format;
    }
}
